//
//  MessageTableViewCell.m
//  QQ界面
//
//  Created by apple on 16/10/27.
//  Copyright © 2016年 LWB. All rights reserved.
//

#import "MessageTableViewCell.h"
#import "InterfaceMessage.h"
@interface MessageTableViewCell()
@property (weak, nonatomic) IBOutlet UIImageView *LWBimageView;
@property (weak, nonatomic) IBOutlet UILabel *LWBtextlabel;
@property (weak, nonatomic) IBOutlet UILabel *LWBdetailTextLabel;
@property (weak, nonatomic) IBOutlet UILabel *LWBtimes;
@property (weak, nonatomic) IBOutlet UILabel *LWBmessagenum;
@property (strong,nonatomic)InterfaceMessage *cellData;
@end
@implementation MessageTableViewCell

+(instancetype) cellWithTableView:(UITableView *)tableview{
    static NSString *cellID = @"cell";
    MessageTableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        //IB中创建cell
        cell = [[[NSBundle mainBundle] loadNibNamed:@"MessageTableViewCell" owner:self options:nil] lastObject];
    }
    return cell;
}
-(void)setUPControlProperties{
    self.LWBmessagenum.layer.cornerRadius = 7;
    self.LWBmessagenum.clipsToBounds = YES;
    [self.LWBimageView.layer setMasksToBounds:YES];
    self.LWBimageView.layer.cornerRadius = 20;
    self.LWBimageView.layer.borderWidth = 3.0f;
    self.LWBimageView.layer.borderColor = [[UIColor clearColor]CGColor];
}
-(void)setCellData:(InterfaceMessage *)cellData{
    _cellData = cellData;
    self.LWBtextlabel.text = cellData.name;
    self.LWBdetailTextLabel.text =cellData.text;
    self.LWBimageView.image = [UIImage imageNamed:cellData.icon];
    self.LWBtimes.text = cellData.time;
    if (cellData.unreadnum ==0) {
         self.LWBmessagenum.text = [NSString stringWithFormat:@"%@",cellData.unreadnum];
    }else{
        self.LWBmessagenum.hidden = YES;
    }
    //self.LWBmessagenum.layer.cornerRadius = 7;
}
//-(void)setCellData:(NSNumber *)cellData {
//    _cellData = cellData;
//    self.imageView.image = [UIImage imageNamed:@"icon"];
//    self.LWBdetailTextLabel = cellData.
////    self.photoView.image = [UIImage imageNamed:@"icon"];
////    self.titleLabel.text = cellData.titleNumber;
////    self.descLabel.text = cellData.detailDescription;
//}

//- (void)awakeFromNib {
//    [super awakeFromNib];
//    // Initialization code
//}
//
//- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
//    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
//}

@end
